<template>
  <PipeSelectTree
    v-model="selectValue"
    :options="categoryTree"
    :loading="isLoading"
  />
</template>

<script setup lang="ts">
import { computed } from 'vue';
import { useCategoryStore } from '@/stores/category';
const categoryStore = useCategoryStore();
const { getCategoryTree } = categoryStore;

const categoryTree = getCategoryTree();
const isLoading = computed(() => !categoryTree.value?.length);

const props = defineProps({
  modelValue: {
    type: [Number, String],
    required: true,
    default: ''
  }
});

// emits
const emits = defineEmits(['update:modelValue']);

const selectValue = computed({
  get: () => props.modelValue,
  set: (val) => {
    emits('update:modelValue', val);
  }
});
</script>

<style lang="scss"></style>
